<!--#include file="pjson.asp"-->
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>表管理</title>
<%easp.include "h.asp"%>
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-card"><br>
      <div class="layui-form layui-card-header layuiadmin-card-header-auto">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">表名</label>
            <div class="layui-input-block">
              <input type="text" name="tn" class="layui-input">
            </div>
          </div>

          <div class="layui-inline">
            <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="t_search">
              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
            </button>
          </div>
        </div>
      </div>

      <div class="layui-card-body">
		<script type="text/html" id="barDemo">
			<a class="layui-btn layui-btn-xs" lay-event="t_show2">填表</a>
		</script>
		<table id="t" lay-filter="t"></table><br>
      </div>
    </div>
  </div>

  <script src="/dzps/src/layuiadmin/layui/layui.js"></script>  
  <script>
  layui.config({
    base: '/dzps/src/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'useradmin', 'table'], function(){
    var $ = layui.$
    ,form = layui.form
    ,admin = layui.admin	
    ,table = layui.table;
    form.render();
	table.render({
        elem: '#t',
        url: layui.setter.base + 'lib/reg.asp?action=t_list',
        cols: [[
		{type:'checkbox'},		
        {
            field: 'id',
            title: 'ID',
            width: 60,
            sort: true,
			hide:false
        },
        {field: 'tn',title: '表名',width: 120},
        {field: 'prn',title: '所属项目',width: 150},
        {field: 'cjcs',title: '采集次数',width: 90},	
        {field: 'f1',title: '表名',width: 150},		
        {
            fixed: 'right',
            width: 200,
            align: 'center',
            toolbar: '#barDemo'
        }]],
        id: 't',
        limit: 10,
        page: true,
        height: 475
    });
    table.on('tool(t)',
    function(obj) {
        var data = obj.data;

		if (obj.event === 't_show') {
			var _this = $(this);
			  layer.open({
				type: 2
				,title: '[dy:title]'
				,content: 'list_t4input.asp?now=' + new Date().getTime()+"&id="+data.id+"&tn="+data.tn+"&sszid="+data.bh+"&prj_id="+data.prj_id
				,maxmin: true
				,area: ['500px', '750px']
				,btn: ['确定', '取消']
				,yes: function(index, layero){
				  var iframeWindow = window['layui-layer-iframe'+ index]
				  ,submitID = 'LAY-user-front-submit'
				  ,submit = layero.find('iframe').contents().find('#'+ submitID);
				  iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
					var field = data.field; 
						$.post(layui.setter.base + 'lib/reg.asp?now=' + new Date().getTime(), {
							action: "[dy:tn]_edit",
							field
						},
						function(data) {
							if (data == '1') {
								layer.msg("成功!!");
							} else {
								layer.msg("失败！！ "+data);
							}
						});
					table.reload('[dy:tn]'); //数据刷新
					layer.close(index); //关闭弹层
				  });  
				  submit.trigger('click');
				}
				,success: function(layero, index){
				}
				});				
			table.reload('[dy:tn]');
		}
		else if(obj.event === 't_show2'){
			location.href = 'list_t4input.asp?now=' + new Date().getTime()+"&id="+data.id+"&tn="+data.tn+"&sszid="+data.bh+"&prj_id="+data.prj_id;
			
		}
	
	});	
  });
  </script>
</body>
</html>